package com.colin.aiyi.dao.ImpxUtils3_de;

import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.response.BaseResponse;
import com.colin.aiyi.presenter.Interface.Callback;

import org.xutils.http.RequestParams;

/**
 * Created by hl on 2017/5/5.
 */

@Deprecated
public class ImpRegister extends AbsServicexUtils<BaseResponse> {

    @Override
    public void onSuccess(String result) {
        super.onSuccess(result);
        BaseResponse baseResponse=gson.fromJson(result,BaseResponse.class);
        callback.onSuccess(baseResponse);
    }


    @Override
    public void getAllT(Callback<BaseResponse> callback, String... type) {
        super.getAllT(callback, type);
        rigister(type[0],type[1],type[2]);
    }
    /*********
     * 注册
     * clientId	是	string	xx
    clientSecret	是	string	xx
    telNo	是	string	手机号
    password	是	string	密码
    messageCode	是	string	验证码
     */
    private void rigister(String telNo,String pd,String msgcode){
        RequestParams params=new RequestParams(Constant.register);
        params.addBodyParameter("accessToken","");
        params.addBodyParameter("clientId",Constant.CLIENT_ID);
        params.addBodyParameter("clientSecret",Constant.CLIENT_SECRET);
        params.addBodyParameter("telNo",telNo);
        params.addBodyParameter("password",pd);
        params.addBodyParameter("messageCode",msgcode);
        sendToServer(params,1);
    }


    @Override
    public void getTById(Callback<BaseResponse> callback, String id) {
       super.getTById(callback,id);
       sendVcode(id);

    }
    /*********
     *  发送注册码
     * telNo	是	string	手机号
    clientId	是	string
    clientSecret	否	string
     */
    private void sendVcode(String telNo){
        RequestParams params=new RequestParams(Constant.register_sendCode);
        params.addBodyParameter("telNo",telNo);
        params.addBodyParameter("accessToken","");
        params.addBodyParameter("clientId",Constant.CLIENT_ID);
        params.addBodyParameter("clientSecret",Constant.CLIENT_SECRET);
        sendToServer(params,1);

    }



}
